package ltd.hxya.novel.crawl.feign;

import io.swagger.annotations.ApiParam;
import ltd.hxya.novel.common.bean.Result;
import ltd.hxya.novel.common.to.book.BookChapterTo;
import ltd.hxya.novel.common.to.book.BookTo;
import ltd.hxya.novel.common.vo.BookIndexVo;
import ltd.hxya.novel.entity.crawl.LastCrawlIndex;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.concurrent.ExecutionException;

@FeignClient("novel-book")
public interface BookFeignService {

    @GetMapping("/book/listAllBook")
    public Result<List<BookTo>> listAllBook();

    @PutMapping("/book/bookContent/batchSaveContent")
    public Result bookContent(@RequestBody List<BookChapterTo> bookChapterTos);

    @PutMapping("/book/saveBookInfo")
    public Result<BookTo> saveBookInfo(@RequestBody BookTo book) throws ExecutionException, InterruptedException;

    @GetMapping("/book/isAdd")
    public Result<List<BookTo>> isAdd(@RequestBody BookTo book);

    @GetMapping("/book/bookInfoById/{bookId}")
    public Result<BookTo> bookInfoById(@PathVariable("bookId") String bookId);

    @PostMapping("/book/bookIndex/listBookIndex")
    public Result<List<BookIndexVo>> listBookIndex(@RequestParam("bookId") String bookId,@RequestParam("sort") Integer sort );

    @PostMapping("/book/lastCrawlIndex/getLastIndex")
    Result<LastCrawlIndex> bookLastIndex(BookTo bookTo);

    @GetMapping("/book/lastCrawlIndex/lastIndexList")
    Result<List<LastCrawlIndex>> lastIndexList(@RequestParam("sourceId") Integer sourceId);
}
